<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../css/prewimg.css">
		<style type="text/css">
			html,
			body {
				background-color: white;
			}
			
			.mui-bar {
				box-shadow: none;
			}
			
			.mui-title {
				color: #208AFE;
				font-size: 18px;
			}
			
			.del-div {
				position: absolute;
				font-size: 16px;
				right: 15px;
				bottom: 10px;
				color: #208AFE;
			}
			
			.mui-icon span {
				font-size: 16px;
			}
			
			.mui-content {
				border: hidden;
				display: none;
				background-color: #FFFFFF;
			}
			
			.allcontent {
				width: 90%;
				margin-left: 5%;
			}
			
			.allcontent p {
				color: black;
			}
			
			.showtoggle {
				display: none;
			}
			
			.money-div {
				color: #AFAFB2;
			}
			
			.pricesize {
				font-size: 85%;
			}
			
			.money-div .text1 {
				margin-left: 5%;
				color: red;
			}
			
			.money-div .text2 {
				float: right;
				color: #208AFE;
				font-size: 80%;
			}
			
			.area-div {
				display: flex;
				margin-top: 6px;
				font-size: 85%;
			}
			
			.area-div1 {
				width: 80%;
				color: black;
				margin-left: 5%;
			}
			
			.text-div {
				width: 90%;
				margin-left: 5%;
				color: #AFAFB2;
				font-size: 85%;
				margin-top: 6px;
			}
			
			.fiends-div {
				width: 100%;
				background-color: white;
				padding: 3% 0;
				font-size: 100%;
				display: flex;
				flex-wrap: nowrap;
			}
			
			.fiends-div .friend-heddimg {
				width: 18%;
				margin-right: 5%;
				margin-left: 5%;
				height: 10%;
			}
			
			.fiends-div .agree-button {
				padding: 0;
				position: absolute;
				right: 3%;
				background-color: #077DFF;
				border: 0;
				padding: 0.5% 3%;
				font-size: 95%;
				color: #FFFFFF;
				z-index: 99;
			}
			
			.fiends-div .yagree-div {
				position: absolute;
				right: 5%;
				background-color: #FFFFFF;
				font-size: 80%;
				border-radius: 3px;
				color: #077DFF;
			}
			
			.card-div {
				display: none;
			}
			
			.conttext-div {
				display: flex;
				flex-wrap: wrap;
				padding: 0;
			}
			
			.conttext-div .div1 {
				display: block;
				width: 90%;
				padding: 0;
				list-style: none;
			}
			
			.div2 {
				color: #A9A9A9;
				font-size: 80%;
			}
			
			.div2 .img1 {
				width: 6%;
				position: absolute;
				right: 5%;
			}
			
			.div2 .img2 {
				width: 6%;
				position: absolute;
				margin-left: 3%;
			}
		</style>
	</head>

	<body>

		<header class="mui-bar mui-bar-nav" id="header">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"><span>返回</span></a>
			<h1 class="mui-title">详情</h1>
			<div class="del-div" id="del-div">删除</div>
		</header>

		<div class="mui-content" id="mui-content">
			<div class="mui-slider mui-slider-loop showtoggle" id="goodstype1">
				<div class="mui-slider-group">
					<div class="mui-slider-item mui-slider-item-duplicate"><img src="" data-preview-src="" data-preview-group="0" /></div>
				</div>
			</div>

			<div class="mui-slider mui-slider-loop showtoggle" id="goodstype2">
				<div class="mui-slider-group">
					<div class="mui-slider-item mui-slider-item-duplicate"><img src="" data-preview-src="" data-preview-group="1" /></div>
					<div class="mui-slider-item mui-slider-item-duplicate"><img src="" data-preview-src="" data-preview-group="1" /></div>
				</div>
				<div class="mui-slider-indicator">
					<div class="mui-indicator mui-active"></div>
					<div class="mui-indicator"></div>
				</div>
			</div>

			<div class="mui-slider mui-slider-loop showtoggle" id="goodstype3">
				<div class="mui-slider-group">
					<div class="mui-slider-item mui-slider-item-duplicate"><img src="" data-preview-src="" data-preview-group="2" /></div>
					<div class="mui-slider-item"><img src="" data-preview-src="" data-preview-group="2" /></div>
					<div class="mui-slider-item mui-slider-item-duplicate"><img src="" data-preview-src="" data-preview-group="2" /></div>
				</div>
				<div class="mui-slider-indicator">
					<div class="mui-indicator mui-active"></div>
					<div class="mui-indicator"></div>
					<div class="mui-indicator"></div>
				</div>
			</div>

			<div class="allcontent">
				<p id="goodstext"></p>
				<div class="money-div pricesize">
					价格<text class='text1' id="price"></text>
					<text class='text2' id="typegood"></text>
				</div>

				<div class="area-div money-div">
					地址
					<div class="area-div1" id="areagood">

					</div>
				</div>
			</div>
			<div style="border-bottom: 1px solid #F7F7F7;margin-top: 10px;"></div>
			<div class="text-div">售卖人信息</div>
			<div class="fiends-div" id="fiends-div">

				<img src="" class="friend-heddimg" id="headmiggg" />
				<div class="conttext-div">
					<div class="div1" id="nickname">
						安抚预热
					</div>
					<div class="div1 div2">
						手机号：<text id="tel"></text>
					</div>
					<div class="div1 div2">
						账号：<text id="card"></text>
					</div>
				</div>
			</div>
		</div>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/immersed.js"></script>
		<script src="../../js/mui.zoom.js"></script>
		<script src="../../js/mui.previewimage1.js"></script>
		<script type="text/javascript">
			mui.previewImage();
			mui.init();
			mui.plusReady(function() {
				starbar();
				plus.navigator.setStatusBarStyle('dark');
				plus.nativeUI.showWaiting();

				var viewwidth = document.body.clientWidth;
				document.getElementById('mui-content').style.paddingBottom = "-webkit-calc(" + viewwidth * 0.13 + "px)";
				document.getElementById('headmiggg').style.height = "-webkit-calc(" + viewwidth * 0.18 + "px)";
				
				var imgs = '';
				mui.ajax('https://www.lunyuwang.com/taskController/queryGoodDetail', {
					data: {
						lygood_Idd: plus.webview.currentWebview().idd
					},
					crossDomain: true, //强制使用5+跨域
					dataType: 'json', //服务器返回json格式数据
					type: 'get', //HTTP请求类型
					timeout: 10000, //超时时间设置为10秒；
					//processData: false,
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					success: function(data) {
						var cardtext = data.goodUser;
						var goodtext = data.good;
						imgs = goodtext.lygood_Img;
						var goodimgs = goodtext.lygood_Img.split(",");
						var goodimgsbox = '';
						if(goodimgs.length == 1) {
							goodimgsbox = document.getElementById('goodstype1');
							goodimgsbox.getElementsByTagName('img')[0].src = goodimgs;
							goodimgsbox.style.display = 'block';
						} else if(goodimgs.length == 2) {
							goodimgsbox = document.getElementById('goodstype2');
							goodimgsbox.getElementsByTagName('img')[0].src = goodimgs[0];
							goodimgsbox.getElementsByTagName('img')[1].src = goodimgs[1];
							goodimgsbox.style.display = 'block';
						} else {
							goodimgsbox = document.getElementById('goodstype3');
							goodimgsbox.getElementsByTagName('img')[0].src = goodimgs[0];
							goodimgsbox.getElementsByTagName('img')[1].src = goodimgs[1];
							goodimgsbox.getElementsByTagName('img')[2].src = goodimgs[2];
							goodimgsbox.style.display = 'block';
						}
						document.getElementById('goodstext').textContent = goodtext.lygood_Text;
						document.getElementById('price').textContent = "￥" + goodtext.lygood_Price;
						document.getElementById('typegood').textContent = goodtext.lygood_Flag;
						document.getElementById('areagood').textContent = goodtext.lygood_Address;
						document.getElementById('headmiggg').src = cardtext.lyuser_FacePath;
						document.getElementById('nickname').textContent = cardtext.lyuser_NickName;
						document.getElementById('tel').textContent = cardtext.lyuser_Tel;
						document.getElementById('card').textContent = cardtext.lyuser_Card;
						plus.nativeUI.closeWaiting();
						document.getElementById('mui-content').style.display = "block";
					},
					error: function(xhr, type, errorThrown) {
						mui.toast('发布异常!')
					}
				})

				document.getElementById('del-div').addEventListener('tap', function() {
					mui.confirm('确认删除？', function(e) {
						if(e.index == 0) {
							mui.ajax('https://www.lunyuwang.com/taskController/deleteMyGood', {
								data: {
									lygood_Idd: plus.webview.currentWebview().idd,
									lygood_Img: imgs
								},
								crossDomain: true, //强制使用5+跨域
								dataType: 'json', //服务器返回json格式数据
								type: 'get', //HTTP请求类型
								timeout: 10000, //超时时间设置为10秒；
								//processData: false,
								headers: {
									'Content-Type': 'application/x-www-form-urlencoded'
								},
								success: function(data) {
									if(data.state == 1) {
										mui.toast("删除成功!");
										var preView = plus.webview.currentWebview().opener(); //触发上一个页面刷新图片事件
			                         	mui.fire(preView,'del_thegoods',{ 
			                         		iid: plus.webview.currentWebview().idd
			                         	}); 
			                         	mui.back();
									} else {
										mui.toast("删除异常,请重新操作")
									}
								},
								error: function(xhr, type, errorThrown) {
									mui.toast('删除异常!')
								}
							})
						}
					})
				})
			})
		</script>
	</body>

</html>